package org.example.myleet.p867;

public class Solution {
    /**
     * 1 ms
     */
    public int[][] transpose(int[][] matrix) {
        int m = matrix.length, n = matrix[0].length, x = 0, y = 0;
        int[][] result = new int[n][m];
        for (int i=0; i<m; i++) {
            for (int j=0; j<n; j++) {
                result[x++][y] = matrix[i][j];
            }
            x = 0;
            ++y;
        }
        return result;
    }
}
